feat(target-allocator): add allowInsecureAuthSecrets option#5088
feat(target-allocator): add allowInsecureAuthSecrets option#5088tillwulfram wants to merge 1 commit into
Conversation
swiatekm
left a comment
There was a problem hiding this comment.
I think we should make this a field on the TargetAllocator CRD rather than force users to go through env variables.
We should also add an e2e test for this functionality, similar to the existing mtls tests.
| }) | ||
| } | ||
|
|
||
| func TestAllowInsecureAuthSecrets(t *testing.T) { |
There was a problem hiding this comment.
Do we really need these tests specifically for this one config value? Consider adding it to an existing test instead.
| } | ||
|
|
||
| if s.allowInsecureAuthSecrets { | ||
| slog.New(logr.ToSlogHandler(s.logger)).Warn("allowInsecureAuthSecrets is enabled - auth secret values will be served over plain HTTP. " + |
There was a problem hiding this comment.
Why are you using slog here, as opposed to using the existing logger directly?
| ```yaml | ||
| targetAllocator: | ||
| enabled: true | ||
| env: | ||
| - name: ALLOW_INSECURE_AUTH_SECRETS | ||
| value: "true" | ||
| ``` | ||
|
|
||
| > **Warning:** Only enable this when transport-level security is guaranteed by other means. Without mTLS or a service mesh, auth secrets will be transmitted in plaintext. | ||
|
|
There was a problem hiding this comment.
Instead of suggesting this, I'd prefer to add a allowInsecureAuthSecrets on the TargetAllocator CRD.
|
thanks for the feedback @swiatekm! :) |
Description:
Currently the TA can only serve discovered auth data, eg. Kubernetes Secrets from a ServiceMonitor with basicauth, over mtls. This great feature would overcomplicate setups for teams who have existing service mesh which already handles the mtls auth between the services or high maintenance for teams who can't use the operator / crds and also for dev setups.
Its configurable bool via config file, CLI flag (
--allow-insecure-auth-secrets), or environment variable (ALLOW_INSECURE_AUTH_SECRETS) - allowing the most flexibility so the operator crds can cover this setting and also the standalone helm chart from the targetAllocator.-> When enabled, a "warn" log will be written at startup that secret are exposed via plaintext.
Defaults to
falseto maintain backwards compatibility.A next feature could be that also https can be configured so no "heavy" mtls is needed, but at least the transport is secured.
Testing:
Expanded the tests for the new feature in the config, flags and the server files.
All tests, precommits and lints were successful.
Documentation:
Added the new config parameter to the targetAllocator and a short description how it can be used, for which environments it should be used and which problem it can solve.